from presenter import basepresenter

class ArticleTopicsPresenter(basepresenter.BasePresenter):

    def respondToGet(self):
        #get the topics for the discussion
        if (self.request.get('article')):
            thearticle = self.articletask.getByKey(self.request.get('article'))
            self.template_values['article'] = thearticle
            topics = self.discussiontask.getTopicsByArticle(thearticle)

        self.template_values['topics'] = topics

        # set up the page title
        page_title = self.sitetitle + ' - Discussion - ' + thearticle.title
        self.template_values['page_title'] = page_title

        #get the view to draw the page
        self.view.showGetResponse(self.template_values)